; Exercise 1.5
; Given the following two procedures:
                (define (p) (p))
;
                (define (test x y)
                    (if (= x 0)
                        0
                        y))
;
; Describe the behavior of an interpreter that uses applicative-order
; evaluation and the behavior of an interpreter that uses normal-order
; evaluation when evaluating the following expression:
;
;                   (test 0 (p))
;

; applicative order evaluation:

; To evaluate a combination, it does the following:
;   1. It evaluates the subexpressions of the combination.
;   2. It applies the procedure that is the value of the leftmost
;      subexpression (the operator) to the arguments that are the values of
;      the other subexpressions (the operands).

; normal order evaluation:
; "lazy", it fully expands and then reduces. In other words, it substitutes
; operand expressions for parameters until it is able to obtain an expression
; involving only _primitive operators_, and then performs the evaluation.

; applicative order
; (test 0 (p))

; It would begin with the subexpressions of the combination. Evaluating 0 is
; easy, so then it would try to evaluate (p). The problem here is that it is a
; recursive procedure and, thus, it would try to evaluate the recursive call,
; and so on indefinitely. Resulting in an infinite loop.
;
; normal order
; (test 0 (p))
;
; In normal order, it would:
; (test 0 (p))
; (if (= 0 0) 0 (p))
; 0
;


; vim: set lisp expandtabs smarttabs

